package com.jsmtr.rms.controller.UserResumeView;

import com.jsmtr.rms.entity.DUserResume;
import com.jsmtr.rms.entity.ProjectInfoFlow;
import com.jsmtr.rms.service.IDoResumeService;
import com.jsmtr.rms.service.IProjectService;
import com.jsmtr.rms.utils.EnumTools;
import com.jsmtr.rms.utils.ResultBean;
import com.jsmtr.rms.utils.StringTools;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 应聘者应聘流程信息查看控制
 * @author: cyx
 * @description:
 * @date: Created in 2019/2/15 11:53
 * @modified by:
 */
@Controller
public class UserResumeFlowInfoController {
    @Resource
    private IDoResumeService doResumeService;

    @Resource
    private IProjectService projectService;

    @ResponseBody
    @RequestMapping(value = "/UserResume/RecruitmentFlowsInfo")
    public ResultBean RecruitmentFlowsInfo(HttpServletRequest request, HttpServletResponse response){
        String cardNo=  request.getParameter("cardno");
        String pid=request.getParameter("proid");
        String userId=request.getParameter("uid");
        ResultBean resultBean=new ResultBean();
        if (StringTools.notEmpty(userId)){
            try {
                List<Map<String,Object>> resultList=null;
                DUserResume dUserResume=doResumeService.getDUserResume(userId);
                pid=dUserResume.getProid();
                if(StringTools.trimNotEmpty(pid)){
                    if((pid.toUpperCase().indexOf("C_")>=0)&&((pid.toUpperCase().indexOf("E_")>=0))){ //如果是中高职招聘读取HR_ZZUSER中的流转信息
                        resultList= doResumeService.getZZUserDResumeFlowsInfo(userId);
                    }else{
                        resultList= doResumeService.getDResumeFlowsInfo(userId);
                    }
                    resultBean.setState(true);
                    resultBean.setMessage("操作成功! ");
                    resultBean.setDatas(resultList);
                }else {
                    resultBean.setState(false);
                    resultBean.setMessage("操作失败,无法读取招聘方案编号! ");
                    resultBean.setDatas(resultList);
                }

            }catch (Exception e){
                e.printStackTrace();
                return  resultBean;
            }
        }
        return resultBean;
    }




}
